from debug import *
from Fifo_gready import *

def IO_first_gready(tasks,resource):
    #为NDP任务分配最高优先级
    for task in tasks.task_list:
        if "写" in task.task_name or "读" in task.task_name or "Read" in task.task_name or "Write" in task.task_name:
            task.priority = 0
            if is_print:
                print("set",task.task_name,"priority",task.priority)

    #按照优先级对任务进行排序
    tasks.task_list.sort(key=lambda x:x.priority)
    # for task in tasks.task_list:
    #     print(task.task_name)

    return Fifo_gready(tasks,resource)